﻿using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.EBS.WebApi
{
    [CPPEI.WebApi.PostAction("EBS", "Register", "1.0")]
    public class RegisterAction : BaseAction<RegisterParams, RegisterResult>
    {
        protected override ActionResult<RegisterResult> OnExecute(ActionContext context, SysParameters sysParams, RegisterParams opParams)
        {
            RegisterResult actResult = new RegisterResult();
            Domain.Services.RegisterService service = new Domain.Services.RegisterService();

            ServiceResult serResult = service.Register(opParams.AppId,
                opParams.AppToken,
                opParams.Namespace,
                opParams.Event,
                opParams.Callback);

            return new ActionResult<RegisterResult>(serResult.IsSuccess, serResult.ErrorCode, serResult.Message, null);
        }
    }

    public class RegisterParams
    {
        public Guid AppId{get;set;}
        public string AppToken{get;set;}
        public string Namespace{get;set;}
        public string Event{get;set;}
        public string Callback{get;set;}
    }

    public class RegisterResult
    {

    }
}
